|
|
|
|
|
|
|
Figure 19.7
You can use the PaintPicture method to combine
parts from several images into a single composite image. |
|
|
|
|
|
|
|
|
3. The process is repeated several times so that all the information is captured in a composite picture in the PictureBox control. |
|
|
|
|
|
|
|
|
4. The tape counter information is added to the PictureBox control with the Print method, and the SavePicture method saves the image to disk. The entire process repeats itself in a few minutes for the next song. |
|
|
|
|
|
|
|
|
5. The resulting bitmap files provide a means to locate your favorite songs on tape. |
|
|
|
|
|
|
|
|
Two other methods mentioned in the list in the earlier section "Graphics Methods" are the Cls method and the Point method. The Cls method, which stands for Clear Screen like the DOS command, clears all graphics drawn with graphics methods from a form or PictureBox control. The Point method returns the RGB color setting of a specified point, as in the following example: |
|
|
|
|
|
|
|
|
Private Sub Form_Load()
'Draw a red box
Me.AutoRedraw = True
Line (0, 0)-(500, 500), vbRed, BF
End Sub
Private Sub Form_MouseDown(Button As Integer,_
Shift As Integer, X As Single, Y As Single)
If Point(X, Y) = vbRed Then
MsgBox "The point (" & X & "," & Y & ") is in the box"
Else
MsgBox "The point is not in the box"
End If
End Sub |
|
|
|
|
|
|
|
|
The code in the MouseDown event uses the Point method to determine whether the location clicked by the user is within the red box drawn during the form load. |
|
|
|
|
|
|
|
|
Finally, although coverage of graphics API in detail is beyond the scope of this chapter, you should note that some graphics API calls allow you to do things that ordinary graphics methods do not. For example, consider the ListView control, which works like the far right pane of the Windows Explorer. In the report view (or detail mode in Explorer), selecting an item highlights only the left column, making it difficult to read one row all the way across. However, you |
|
|
|
|
|